package com.example.bzh.gamecat.ui.cattery;


import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.os.MessageQueue;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.bzh.gamecat.R;
import com.example.bzh.gamecat.ui.cattery.myactivities.MyActiviesActivity;
import com.example.bzh.gamecat.ui.cattery.mywallet.WalletActivity;
import com.example.bzh.gamecat.ui.cattery.personal.PersonalCenterActivity;
import com.example.bzh.gamecat.ui.cattery.task.TaskActivity;
import com.example.bzh.gamecat.ui.message.innermessage.circle.CircleActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * A simple {@link Fragment} subclass.
 */
public class CatteryFragment extends Fragment {


    @BindView(R.id.mine_head_image)
    ImageView mineHeadImage;
    @BindView(R.id.mine_head_name_tv)
    TextView mineHeadNameTv;
    @BindView(R.id.mine_catnum)
    TextView mineCatnum;
    @BindView(R.id.my_wallet)
    LinearLayout myWallet;
    @BindView(R.id.game_hosting)
    LinearLayout gameHosting;
    @BindView(R.id.game_recharge)
    LinearLayout gameRecharge;
    @BindView(R.id.cattery_camera)
    LinearLayout catteryCarema;
    @BindView(R.id.cattery_task)
    LinearLayout catteryTask;
    @BindView(R.id.cattery_activity)
    LinearLayout catteryActivity;
    @BindView(R.id.cattery_set)
    LinearLayout catterySet;
    @BindView(R.id.personal_setting)
    LinearLayout personalSetting;
    private Unbinder unbinder;

    public CatteryFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment_cattery, container, false);
        unbinder = ButterKnife.bind(this, view);
        return view;
    }

    @OnClick({R.id.personal_setting,R.id.my_wallet, R.id.game_hosting,
              R.id.game_recharge, R.id.cattery_camera, R.id.cattery_activity,
              R.id.cattery_task,R.id.cattery_set})
    public void onItemClick(View view){
        Intent intent = new Intent();
        switch (view.getId()){
            case R.id.personal_setting: //个人设置
                ComponentName name = new ComponentName(getActivity(), PersonalCenterActivity.class);
                intent.setComponent(name);
                startActivity(intent);
                break;
            case R.id.my_wallet:
                ComponentName catteryWallet = new ComponentName(getActivity(),WalletActivity.class);
                intent.setComponent(catteryWallet);
                startActivity(intent);
                break;
            case R.id.game_hosting:
                break;
            case R.id.game_recharge:
                break;
            case R.id.cattery_camera:
                ComponentName catteryCamera = new ComponentName(getActivity(),CircleActivity.class);
                intent.setComponent(catteryCamera);
                startActivity(intent);
                break;
            case R.id.cattery_activity:
                ComponentName catteryActivity = new ComponentName(getActivity(),MyActiviesActivity.class);
                intent.setComponent(catteryActivity);
                startActivity(intent);
                break;
            case R.id.cattery_task:
                ComponentName catteryTask = new ComponentName(getActivity(),TaskActivity.class);
                intent.setComponent(catteryTask);
                startActivity(intent);
                break;
            case R.id.cattery_set:
                break;
        }


        getActivity().overridePendingTransition(R.anim.in_from_right,R.anim.keep);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (unbinder != null) {
            unbinder.unbind();
        }
    }
}
